﻿package toolbar {
	import flash.events.MouseEvent;
	import util.EventParser;
	
	public class SingleButton extends SelectButton {
		public function SingleButton(intro:String, btnGroup:SingleButtonGroup, bgWidth:int = 22):void {
			super(intro, btnGroup, bgWidth);
		}
		
		protected override function onClickHandler(evt:MouseEvent):void {
			if (!useSwitch) {
				return;
			}
			if(btnGroup != null) {
				btnGroup.cancelAll(this);
			}
			//只在按下状态时发送事件，本身不能被点击弹起，只能被同组内其它按钮按下后被动弹起
			if (!state) {
				state = true;
				selected.visible = true;
				EventParser.dispatch(intro);
			}
		}
	}
}